export default function getStackBarChart(origin = []) {
  const category = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
  const title = origin.map(i => i.label);
  const optionSet = [];
  // optionSet.map(i => {
  //   i.name = i.label;
  //   i.markLine = '';
  //   i.data = [i];
  // });
  origin.forEach(i => {
    optionSet.push({
      data: [{
        data: i.data,
        markLine: '',
        name: i.label,
        type: 'bar'
      }]
    });
  });

  const option = {
    legend: {
      data: title
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: category
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: optionSet.map(item => {
      return item.data[0];
    })
  };

  return option;
}
